//文件写入
//导入fs模块
const { error } = require('console');
const fs = require('fs');

fs.writeFile('./座右铭.txt','三人行，必有我师焉',error=>{
    //error 成功错误对象。识别null
    if (error) {
        console.log('写入成功');
    }
})
//同步写入
fs.writeFileSync('./data.txt','test');